<?php
require_once "./sample/php/jssdk.php";
$jssdk = new JSSDK("wx73f8f21829bef9c6", "00ea7e3072f302d457e88b7402dc6429");
$signPackage = $jssdk->GetSignPackage();
?>
<!DOCTYPE html>
<html style="width: 100%;min-height: 100%;">
	<head>
		<meta charset="UTF-8"> 
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
		<title>我的邀请二维码</title>
		<link rel="stylesheet" href="__PUBLIC__/Home/css/common.css">
		<link rel="stylesheet" href="__PUBLIC__/Home/css/main.css">
		<script src="__PUBLIC__/Home/js/zepto.js"></script>
		<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
		<script src="__PUBLIC__/Home/js/delIOS_huitan.js"></script>
<script type="text/javascript">
	wx.config({
			      debug: false,
			      appId: '<?php echo $signPackage["appId"];?>',
			      timestamp: <?php echo $signPackage["timestamp"];?>,
			      nonceStr: '<?php echo $signPackage["nonceStr"];?>',
			      signature: '<?php echo $signPackage["signature"];?>',
			      jsApiList: [
			        'checkJsApi',
			        'onMenuShareTimeline',
			        'onMenuShareAppMessage',
			        'onMenuShareQQ',
			        'onMenuShareWeibo',
			        'onMenuShareQZone',
			      ]
			  });
			
		wx.ready(function(){
			var weiurl = "{$reurl}";
			var weilink = window.location.href;
			var weititle = "{:C('WEB_SITE_TITLE')}";
			var imgurl = "./Public/share/img/chanmaologo.png";
			console.log(weiurl);
	        wx.checkJsApi({
	            jsApiList: ['onMenuShareAppMessage'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
	        });
	         wx.onMenuShareTimeline({
	            title: weititle, 
	            link: weiurl,
	            imgUrl: imgurl, // 分享图标
	            trigger:function(res){
	            },
	            success: function () {
	                //alert('已分享');
	            },
	            cancel: function () {
	            },
	            fail:function(){
	            } 
	        });
	        wx.onMenuShareAppMessage({
	            title: weititle, // 分享标题
	            desc: weilink, // 分享描述
	            link: weiurl, // 分享链接
	            imgUrl: imgurl, // 分享图标
	            type: 'link', // 分享类型,music、video或link，不填默认为link
	            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
	            success: function () {
	              //  alert('hello');
	            },
	            cancel: function () {
	            }
	        });
	         //分享到QQ
	        wx.onMenuShareQQ({
	            title: weititle,
	            desc: weilink,
	            link: weiurl,
	            imgUrl: imgurl, // 分享图标
	            success: function () { 
	               // 用户确认分享后执行的回调函数
	            },
	            cancel: function () { 
	               // 用户取消分享后执行的回调函数
	            }
	        });
	        //分享到腾讯微博
	        wx.onMenuShareWeibo({
	            title: weititle,
	            desc: weilink,
	            link: weiurl,
	            imgUrl: imgurl, // 分享图标
	            success: function () { 
	               // 用户确认分享后执行的回调函数
	            },
	            cancel: function () { 
	                // 用户取消分享后执行的回调函数
	            }
	        });

	        // 分享到qq空间
	        wx.onMenuShareQZone({
			    title: weititle, // 分享标题
			    desc: weilink, // 分享描述
			    link: weiurl, // 分享链接
			    imgUrl: imgurl, // 分享图标
			    success: function () { 
			       // 用户确认分享后执行的回调函数
			    },
			    cancel: function () { 
			        // 用户取消分享后执行的回调函数
			    }
			});
    	});
</script>

	</head>
	<body style="width: 100%;min-height: 100%;" class="box">
		<!-- 分享提示 -->
		<div id="share" style="display:none"><img src="__PUBLIC__/Home/img/share.png"></div>
		<!-- 遮罩层 -->
		<div id="zhezhao" style="display:none;z-index:9999999;opacity:0"></div>
		<!--正文区域-->
		<div id="myYaoMaMain" class="fastscroll">
			<div class="contain maxWidth">
				<div class="top">
					<a class="hz back" href="javascript:;">&#xe600;</a>
				</div>
				<div class="toptext">
					<p class="title">我的邀请二维码</p>
					<p class="con">一日不见, 如三月兮</p>
				</div>
				<!--<div class="middle">
					<div class="wrap">
						<p class="top">
							<span>邀请亲朋好友注册消费得佣金!</span>
						</p>
						<p class="bot">具体参考返佣规则</p>
						<img src="__PUBLIC__/Home/img/gift.jpg" class="gift">
					</div>
				</div>-->
				<div class="bottom">
					<p>
						呼吁朋友扫一扫<br>
						蜜罐儿优选
					</p>
					<!--<img src="__PUBLIC__/Home/img/ma.jpg">-->
					<img src="{:qrcode($user_id,$reurl)}" />
					<!-- <div class="sharebtn">
						分享<span class="img"></span>
					</div> -->
				</div>
			</div>
		</div>
		<script>
			//console.log({$reurl});
			//返回按钮
			$('#myYaoMaMain .back').on('tap',function(){
				window.history.go(-1);
			});

			//点击分享按钮
			$('.sharebtn').on('click',function(){
				$('#share').css('display','block');
			});

			//点击遮罩
			$('#share').on('click',function(){
				$('#share').css('display','none');
			});
		</script>
	</body>
</html>
